program main

    use space_manager
    use dynamic_quantities
    use partition_of_unity
    use mesh_manager
    use run_manager

    implicit none

    integer :: i, j
    character(20) :: namelist_file
    logical :: alive

    call getarg(1, namelist_file)
    inquire(file=namelist_file, exist=alive)
    if(alive == .false.) then
        write(*,*) "namelist file ", trim(namelist_file), " is not found"
        stop
    end if

    call space_manager_init(namelist_file)

    call dynamic_quantities_init(namelist_file)

    call mesh_manager_init(namelist_file)

    call dynamic_quantities_input

    call partition_of_unity_init(namelist_file)

    call partition_of_unity_approximate(1)

    call mesh_manager_parcel_to_grid

    call run_manager_end_run

end program main
